package com.zuoye.text5;


import com.text5.News;

import java.sql.SQLException;
import java.util.List;

public class Fun1 {
    public static void main(String[] args) throws SQLException {
        NewsDaoImpl1 newsDao=new NewsDaoImpl1();



        //查
        List<News1> newsList=newsDao.getNewsList();
        for(News1 news:newsList){
            System.out.println(news.getId()+"\t"+news.getTitle()+"\t"+news.getSummary()+"\t"+news.getContent()+"\t"+news.getAuthor()+"\t"+news.getCreateDate());
        }


        //增
        News1 news = new News1();
        news.setCategoryId(2);
        news.setTitle("dfsdfgdfggfdgfdgfdg");
        news.setSummary("1");
        news.setContent("2");
        newsDao.add(news);

        //删
       /* newsDao.delete(10);
*/

        //改
        /*News1 news1 = new News1();
        news1.setTitle("食物1");
        news1.setId(6);

        newsDao.update(news1);*/
    }


}
